# encoding: utf-8

from .models import OperationRecord
from app.extensions import log, db
from app.modules.common.utils import DbCommit

"""
新增操作记录
"""


def addOperationRecord(operation_type, key, old_value, new_value, desc, **kwargs):
    _record = OperationRecord(kwargs['login_user_id'], kwargs['login_user_name'], operation_type, desc, key, old_value,
                              new_value)
    db.session.add(_record)
    _rtn = DbCommit()
    log.info('新增操作记录.info: %s , 返回: %s' % (_record.to_dict(), _rtn))
